{include file="common/head"}
<head>
<title>员工管理</title>

<style>
    a{text-decoration:none;}
        input{display:initial!important;}    
</style>
</head>
<body >
<div class="container-fluid">
    <form action="/index.php/user/index" method="post">
        <div class="row" id="query_bar" style="height: 50px;line-height: 50px;">
            <div class="col-4" style="text-align: left;line-height: 50px;font-size: 2rem;" >
                职员管理【{$data['total']}人】
            </div>
            <div class="col-8">
            <label for="dept_id" >部门：</label>
            <select name="dept_id" class="form-control" style="width:140px;display:initial;">
                <option value="">所有部门</option>
                {foreach $school as $dept}
                    <option value="{$dept.id}" {if $dept.id==$dept_id}selected{/if} >{$dept['name']}</option>
                {/foreach}
            </select>

            <label for="name_or_mobile" >姓名或手机：</label>
            <input class="form-control" type="text"  id="name_or_mobile" name="name_or_mobile" value="{$name_or_mobile}" placeholder="姓名" />
            <button type="button" class="btn btn-warning query" style="vertical-align: middle;" >
                <span class="bi-search" ></span>
            </button>
            </div>
        </div>
    </form>

    <table class="table table-sm table-hover table-striped table-bordered">
        <thead class="table-info">
            <th>序号</th>
            <th>工号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>年龄</th>
            <th>电话</th>
            <th style="max-width: 400px;word-break: break-word;">地址</th>
            <th>部门</th>
            <th>级别</th>
            <th>权限组</th>
            <th>照片</th>
            <th>入职日期/登记人</th>
            <th>编辑日期/编辑人</th>        
            <th>状态</th>
            <th>
                <button type="button" class="btn btn-sm btn-primary">
                    <a href="/index.php/user/user_add" alt="员工入职登记(New employee)"><span class="bi-plus-lg" style="color:white;"></span></a>
                </button>
            </th>
        </thead>
        <tbody>
            {foreach $data['data'] as $k=>$kv}
            {if $kv['id']>2}            
            <tr>
                <td>{$k+1}</td>
                <td>{$kv['uid']}<c style="color:red;">{$kv['verify_str']}</c></td>
                <td>{$kv['name']}</td>
                <td>{$kv['sex']}</td>
                <td>{$kv['age']}</td>
                <td>{$kv['mobile']}</td>
                <td>{$kv['address']}</td>
                <td>{$kv['dept_id_name']}</td>
                <td>{$kv['level_name']}</td>
                <td>{$kv['group_id_name']}</td>
                <td><img src="{$kv['image']}" class="goods_image" style="width:40px;" alt="image lost" /></td>
                <td>{$kv['create_time']}<br/>{$kv['creater_name']}</td>
                <td>{$kv['update_time']}<br/>{$kv['updater_name']}</td>
                <td>{$kv['status_name']}</td>
                <td>

                    <a href="/index.php/user/edit/id/{$kv['id']}">
                        <button style="button" class="btn btn-sm btn-info"><span class="bi-pencil"></span></button>
                    </a>
                    <button type="buttun" onClick="resetPwd({$kv['id']})" class="btn btn-sm btn-danger"> 
                        <span class="bi-key"></span>
                    </button>
                    </a>

              
                </td>
            </tr>
            {/if}            
            {/foreach}

        </tbody>    
    </table>
</div>

</body>

<script type="text/javascript">

 $(function(){

    $(".query").on('click',function(){
        var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2

        $("form").submit();
        layer.close(index);
    }) 

    $(".goods_image").on('click',function(){
        var img = $(this).attr('src');
        if(!img.trim()) return;

        layer.open({
          type: 1,
          title:'',
          closeBtn: 0, //不显示关闭按钮
         // anim: 1,
          time: 5*1000,
          shadeClose: true, //开启遮罩关闭              
          skin: 'layui-layer-rim', 
          content: "<img src='"+img+"' style='width:100%'>"
        });
    })    
 })

  function resetPwd(uid){
    if(!uid) return false;
      layer.confirm('是否确定重置帐号密码?', {
        btn: ['YES','CANCEL']
      }, function(){
        window.location.href="/index.php/user/resetPwd/id/"+uid;
      }, function(){
        layer.msg("Cancel!");
        return 0;
      });    
  }

</script>


</body>
</html>
